<!DOCTYPE html>
<html>
<script type="text/javascript">
function checkPC() {
	if(!isPC()) {
		window.location.href = 'windex.html';
	}
	function isPC() {
			var userAgentInfo = navigator.userAgent;
			var Agents = ["Android", "iPhone",
									"SymbianOS", "Windows Phone",
									"iPad", "iPod"];
			var flag = true;
			for (var v = 0; v < Agents.length; v++) {
					if (userAgentInfo.indexOf(Agents[v]) > 0) {
							flag = false;
							break;
					}
			}
			return flag;
	}
};
checkPC();
window.onresize = checkPC;
</script>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>微商CEO</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
	<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' 'self' ws.didadiandan.com ;">
	<link rel="stylesheet" href="css/home.css">
  <style media="screen">

    .page {
      /*background-color: #f7f7f7;*/
    }
  </style>
</head>
<!--[if lte IE 7]>
<body scroll="no">
<![endif]-->
<!--[if gt IE 7]><!-->

<body>
	<!--<![endif]-->
	<div class="header">
		<div class="container">
			<ul>
				<li><a href="index.html"><img src="./images/C-E-O.png" alt=""></a></li>
				<li><a class="lia " href="index.html">首页</a></li>
				<li><a class="lia active" href="">品牌方入驻</a></li>
			</ul>
			<ul>
				<li class="downloadCEO">
					<a class="Android" href="javascript:void(0);"><img src="./images/Android.png" alt=""><span>Android</span></a>
				</li>
				<li class="downloadCEO">
					<a class="IOS" href="javascript:void(0);"><img src="./images/IOS.png" alt=""><span>IOS</span></a>
				</li>
			</ul>
		</div>
	</div>
	<div id="pageContain">
		<div class="page pageEnter current">
			<div class="contain">
        <ul class="submitSuccess" style="display:none">
        	<li><img src="./images/success.png" alt=""></li>
        	<li><span>品牌名：</span><span class="brandName">xxxxxxxxxxx</span></li>
        	<li><span>公司名：</span><span class="companyName">xxxxxxxxxxx</span></li>
        	<li><span>账<u>xx</u>号：</span><span class="username">xxxxx</span></li>
        	<!-- <li><span>密<u>xx</u>码：</span><span class="password">xxxxx</span></li> -->
					<li>
            <a href="http://ws.didadiandan.com"><div class="blueBtn">前往后台</div></a>
          </li>
        </ul>
        <ul class="form">
          <li>
            <label for="company">公<u>x</u>司<u>x</u>名：</label>
            <input id="company" type="text" maxlength="50">
          </li>
          <li>
            <label for="logoNname">品<u>x</u>牌<u>x</u>名：</label>
            <input id="logoNname" type="text" maxlength="50">
          </li>
          <li>
            <label for="personInCharge">负<u>x</u>责<u>x</u>人：</label>
            <input id="personInCharge" type="text" maxlength="50">
          </li>
          <li>
            <label>产品方向：</label>
            <div class="proxyRight">
              <select id="select" class="" name="">
                <option value="0">请选择</option>
                <option value="1">服装服饰类</option>
                <option value="2">美妆产品类</option>
                <option value="3">鞋包首饰类</option>
                <option value="4">母婴用品类</option>
                <option value="5">生活家居类</option>
                <option value="6">数码产品类</option>
                <option value="7">奢侈品代购</option>
                <option value="8">异地代送礼</option>
                <option value="9">限量品拍卖</option>
                <option value="10">成人用品类</option>
                <option value="11">以物易物</option>
                <option value="12">品牌代理</option>
              </select>
            </div>
          </li>
          <li>
            <label for="proxy">代理规模：</label>
            <span class="proxyRight">
              <input checked type="radio" id="small" name="scale" value="1"><label for="small">0-99</label>
              <input type="radio"  id="middle" name="scale" value="2"><label for="middle">100-499</label>
              <input type="radio"  id="lage" name="scale" value="3"><label for="lage">500以上</label>
            </span>
          </li>
          <li>
            <label for="phone">手<u>x</u>机<u>x</u>号：</label>
            <input id="phone" type="tel">
          </li>
          <li>
            <label for="phone">验<u>x</u>证<u>x</u>码：</label>
						<span class="proxyRight ">
              <input class="code" id="captcha" type="tel">
              <span class="code greenBtn " id="codeBtn">获取验证码</span>
            </span>
          </li>
          <li>
            <div id="confirm" class="blueBtn">获取账号</div>
          </li>
        </ul>
			</div>
		</div>
	</div>
	<div class="modal">
		<div class="modalContent">
			<ul class="downLoad">
				<li><img src="./images/model.png" alt=""></li>
				<li>
					<div class="p">
						<p>小小CEO，</p>
						<p>大大成功路</p>
					</div>
					<div class="btn">
						<img src="./images/IOS.png" alt="">
						<span>iphone&nbsp;下载</span>
					</div>
					<div class="btn">
						<img src="./images/Android.png" alt="">
						<span>Android&nbsp;下载</span>
					</div>
				</li>
				<li>
					<div class="close-x"><img src="./images/x.png" alt=""></div>
					<img class="img" src="./images/qrcode.png" alt="">
					<p>扫描二维码</p>
					<p>下载CEO</p>
				</li>
			</ul>
		</div>
	</div>
	<script src="js/jquery.min.js" charset="utf-8"></script>
	<script type="text/javascript" src="js/fullPage.min.js"></script>
	<script type="text/javascript">
		var runPage;
		runPage = new FullPage({
			id: 'pageContain',
			continuous: true,
			slideTime: 1000,
			effect: {
				transform: {
					translate: 'X',
					scale: [0.1, 1],
					rotate: [0, 0]
				},
				opacity: [0, 1]
			},
			mode: 'click,wheel,touch',
			easing: [0, .93, .39, .98],
		});
	</script>
	<script type="text/javascript">
		var HOST = "http://ws.didadiandan.com";
		var HOST2 = "http://192.168.0.111:8090";
		$('.downloadCEO').on('click',function () {
			$('.modal').show();
		})
		$('.modal').on('click','.close-x',function () {
			$('.modal').hide();
		})

    function Charge(options) {
			this.confirm = true;
      if(options) {
				var self = this;
	      var arr = options.arr || [];
	      var labelArr = options.labelArr || [];
	      var mobile = options.mobile || '';
				if(self.checkNotNone(arr,labelArr)) {
					if(self.checkPhone(mobile)) {
						self.confirm = false;
					}
				}
			}
  }
  Charge.prototype = {
    /***
      *@param arr {Array} 需要传入验证的内容id数组
      *@param labelArr {Array} 需要传入验证的提醒内容数组
      *@return Boolean
      **/
      checkNotNone:function (arr,labelArr) {
          var item;
          for (var i = 0; i < arr.length; i++) {
            item =$("#"+arr[i]).val();
            if(item == "" || item == 0) {
              alert(labelArr[i]);
              return false;
            }
          }
          return true;
      },
      checkPhone:function (mobile) {
          var reg = /^(13[0-9]|14[0-9]|15[0-9]|18[0-9])\d{8}$/i;
          if (!reg.test(mobile)) {
              alert("请输入正确的手机号！");
              return false;
          }
          return true;
      }
  }
	document.getElementById('confirm').onclick = function () {
		var arr = ['company','logoNname','personInCharge','phone','select'];
		var labelArr = ['公司名不能为空','品牌名不能为空','负责人不能为空','联系方式不能为空','请选择产品方向'];
		var charge = new Charge({
	    arr:arr,
	    labelArr:labelArr,
	    mobile:$('#phone').val()
	  });
		if(charge.confirm) {
			return false;
		}
		console.log($('input:radio[name="scale"]:checked').val());
		var params = {
			name:$('#company').val(),
			brandName:$('#logoNname').val(),
			heads:$('#personInCharge').val(),
			productDirection:$('#select option:selected').text(),
			mobile:$('#phone').val(),
			captcha:$('#captcha').val(),
			agentSize:$('input:radio[name="scale"]:checked').val()
		}
		$.post(HOST+"/web/companyAccount/createAccount", params, function(result){
				if(100 != result.code){
						alert(result.message);
						return;
				}
				console.log(result);
				var res = result.object;
				/***
				brandName:"logo"
				companyName:"jimu"
				password:"46569535"
				username:"13807388045"
				**/
				$('.form').hide();
				$('.submitSuccess').show();
				$('.brandName').html(res.brandName);
				$('.companyName').html(res.companyName);
				$('.username').html(res.username);
				// $('.password').html(res.password);
		}, "json");
	}

	// 发送短信验证码
	$('#codeBtn').click(function(){
        identifyCode($(this), function(){
						$(this).addClass('gray');
            var checkResult = $('#phone').val();
						if(!checkResult){
								alert("请填写手机号！~")
                return false;
            }
						if(!(new Charge()).checkPhone(checkResult)) {
							return false;
						}
            $.post(HOST+"/common/sms/sendCaptcha.ajax", {mobile: checkResult}, function(result){
								$(this).removeClass('gray');
                if(100 != result.code){
                    alert(result.message);
                    return;
                }
            }, "json");
            return true;
        }, 60);
    });

	/*val 是jquery对象*/
    /*cb 是点击获取验证码的时候执行的函数，可以在这里面请求数据*/
    /*number是秒数*/
    function identifyCode(val, cb, number) {
        // 判断是否能够点击
        if (val.hasClass('gray')) {
            return false;
        }
        // 执行函数
        if (cb) {
            if (!cb()) {
                return false;
            }
        }
        var countNum = number ? number : 60;
        var countdown = countNum;
        var interval = null;
        settime();

        function settime() {
            if (countdown == 0) {
                val.html("获取验证码");
                countdown = countNum;
                val.removeClass('gray').addClass('green');
                return false;
            } else {
                val.html("重新发送" + countdown + "s");
                val.removeClass('green').addClass('gray');
                countdown--;
            }
            interval = setTimeout(function() {
                settime(val);
            }, 1000)
        };
    }
	</script>
</body>

</html>
